home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 4
/
FM Towns Free Software Collection 4 - Disc 1.iso
/
msdos
/
all_dir
/
menu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-18
|
2KB
|
130 lines
#include <stdio.h>
#include <dos.h>
#include <string.h>
#include <malloc.h>
#include <conio.h>
#define ON 1
#define OFF 0
/*
* CRT画面の部分消去
*/
void cls(c)
int c;
{
if(c == 0)
printf("\x1bY");
if(c == 1)
printf("\x1b[=2l");
if(c == 2)
printf("\x1b[=2J");
if(c == 3)
printf("\x1b[K");
}
/*
* カーソルの表示/非表示の設定
*/
void csr(c)
int c;
{
if(c == ON)
printf("\x1b[0v");
else if (c == OFF)
printf("\x1b[1v");
}
/*
* 画面の表示位置設定
*/
void locate(pc,pl)
int pc,pl;
{
printf("\x1b[%d;%dH",pl,pc);
}
/*
* 表示色の設定
*/
void color(c)
int c;
{
static char colorbar[] = "0123456777";
printf("\x1b[");
if(c < 10){
putchar('0');
putchar(';');
putchar('3');
}else if(c < 20){
putchar('0');
putchar(';');
putchar('7');
putchar(';');
putchar('3');
}else if(c < 30){
putchar('0');
putchar(';');
putchar('1');
putchar(';');
putchar('3');
}else if(c < 40){
putchar('0');
putchar(';');
putchar('1');
putchar(';');
putchar('7');
putchar(';');
putchar('3');
}
putchar(colorbar[c%10]);
putchar('m');
}
void back_color(c)
int c;
{
static char colorbar[] = "0123456777";
printf("\x1b[");
if(c < 10){
putchar('0');
putchar(';');
putchar('4');
}else if(c < 20){
putchar('0');
putchar(';');
putchar('7');
putchar(';');
putchar('4');
}else if(c < 30){
putchar('0');
putchar(';');
putchar('1');
putchar(';');
putchar('4');
}else if(c < 40){
putchar('0');
putchar(';');
putchar('1');
putchar(';');
putchar('7');
putchar(';');
putchar('4');
}
putchar(colorbar[c%10]);
putchar('m');
}